package org.dicker.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.mvc.entity.YockMvcAnnotation.Controller;
import org.lanqiao.mvc.entity.YockMvcAnnotation.RequestMapping;
import org.lanqiao.mvc.entity.YockMvcAnnotation.ResponseBody;
import org.lanqiao.mvc.entity.YockMvcAnnotation.ResponseVoid;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.CircleCaptcha;

@Controller
public class VerifyCodeController{

	@RequestMapping(value = "/vcode.do") 
	@ResponseVoid
	public void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(100, 30, 4, 8);
		request.getSession().setAttribute("SYSTEM_CODE", captcha);
		
		captcha.write(response.getOutputStream());
	}
}
